import { _decorator, Component, Node } from 'cc';
import { getGlobal } from '../Global';
const { ccclass, property } = _decorator;

@ccclass('WaitngConnect')
export class WaitngConnect extends Component {
    start() {

    }
    @property(cc.Boolean)
    _isShow;
    @property(cc.Label)
    text;
    @property(cc.Node)
    target;
    update(deltaTime: number) {
        this.target.rotation = this.target.rotation - deltaTime * 45;
    }
    onLoad () {
        let g = getGlobal();
        
        g.wc = this;
        this.node.active = this._isShow;
    }
    show(content) {
        this._isShow = true;
        if (this.node) {
            this.node.active = this._isShow;
        }
        if (this.text) {
            if (content == null) {
                content = "";
            }
            this.text.string = content;
        }
    }
    hide() {
        this._isShow = false;
        if (this.node) {
            this.node.active = this._isShow;
        }
    }
    onDestory(){
        let g = getGlobal();
        g.wc = null;
    }
}

